package com.hundsun.yr.universal.p2p.bean;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONObject;

import android.text.TextUtils;

import com.hundsun.yr.universal.library.data.HSSharedPreferences;
import com.hundsun.yr.universal.library.utils.HSJSONTools;



/**
 * @Title: Invested.java 
 * @Description: 我的投资-已投资
 * @date 2016-1-21 下午4:31:54 
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com 
 * @replace author:
 * @replace date:
 * @version V1.0   
 */
public class VIPUser extends ResponseBean implements Serializable {
	
	private static final long serialVersionUID = 1L;
	

	/**
	 * 创建时间 
	 */
	private String createDate;
	/**
	 * 定向投标编号
	 */
	private String goodsDirectedNo;
	/** 
	 * 用户手机号
	 */
	private String mobile;
	/**
	 * 租户ID
	 */
	private String tenantId;
	/**
	 * 修改时间
	 */
	private String updateDate;
	/**
	 * 用户名称
	 */
	private String userName;
	/**
	 * 用户编号
	 */
	private String userNo;
	public String getCreateDate() {
		return createDate;
	}
	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}
	public String getGoodsDirectedNo() {
		return goodsDirectedNo;
	}
	public void setGoodsDirectedNo(String goodsDirectedNo) {
		this.goodsDirectedNo = goodsDirectedNo;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getTenantId() {
		return tenantId;
	}
	public void setTenantId(String tenantId) {
		this.tenantId = tenantId;
	}
	public String getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(String updateDate) {
		this.updateDate = updateDate;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserNo() {
		return userNo;
	}
	public void setUserNo(String userNo) {
		this.userNo = userNo;
	}
	
	
	/**
	 * 是否为VIP用户
	 * @param vipListStr
	 * @param sharedPreferences
	 * @return
	 */
	public boolean isVIP(String vipListStr,HSSharedPreferences sharedPreferences){
		
		if(TextUtils.isEmpty(vipListStr))return false;
		
		JSONArray array=HSJSONTools.getJsonArray(vipListStr);
		
		for (int i = 0; i < array.length(); i++) {
			JSONObject obj=HSJSONTools.getJSONObjectFromArray(array, i);
			
			if(TextUtils.equals(sharedPreferences.getShareProf(UserInfo.USER_NO), HSJSONTools.getString(obj, "userNo"))){
				return true;
			}
			
		}
		
		return true;
	}
	
	
}
